package com.example.springboot_system.utils;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

public class AlipayConfigQRCode {
    //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id ="2021000117687435";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key ="MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCFb/GbHuIPrDwlB9Vlsy4AU62G3DvsegY/sPH6H4SFVeLsVHlJLed6xbmdHi+DHX3ZR890yWkgd02lEL9q1P3Sv4+fuHqv4nfg8wFwimGGTQeuRBy4N8VcvdkyGktGveGXb1CfOZ3XP/xj16P1CKXdQlyKuCfy9+/YE9aWAL9kPX1yy6iamYtKAb3D9KWqEPOuiDKROiEf4anUVqroT3wFAIZSowjay1GqKo3X0ZjWd1VUE5R1VNV6+xS4BfjXRYyOmBLyW6K10NAUslW71Ow3Zml6qrTNTSs1QVBtw+x76xd3we52zX41QX1gqTZLrBApLtxCCTqOieM0XDb16iglAgMBAAECggEAVwA3/TXTmvhndpV284oyEhB88ZMilvqwnFJYUwa9ttnazM//DFGbvZaxgNmvjMNrzIFfp/uySXK/80HKLHOW0xQHJtJ3W7pDAy4t4By5nYEX4u2R9CKY0fEObfZq4kLnlX8Eh+xfF3smqkptIlRzIKImCGQt1+MERFQa806le0sSz/1do98gHruj8eVaU627pBQnmNgKO5kdd/H9BVcy8drHIm+ZqmjrMFYMnxn51eor50PuzuOOtmPaWKQPpJZ5Q0y8UgTmt4uDuzfrSkO1FABwVAOEHMPJcMK8raPftth6lhuGSEZxhekQs12SF4LKnM9OtRK/e0DQ3ATFMdjtOQKBgQDEOZNuGkjT5qHklnskCVLFRgfL8oXXj55vH7/Zc8RDd/EbX4eIyau8g2+Xy50aIKsNKCDQnzVp944HvaCl7xHcSRrocRZg3xo5ZBbv++XllNkr8ZEgBSxLyK9GiwkY2dvQfytdjdULogbi2YN75g6Wqt7l2CFXGrQT1Y6UNdgrcwKBgQCuFe5TDq7xzWT8Epc7nyMNN/Z8zhWHT17wEueGS3q+X8HTtwAPdT5Ff3y1MWsRfjBAKLCrr/UKkMt0QwePs255ZO4mCwXRpYZdU516tJ3TjnjwxleKWwTbazQT1CHUZUXS3CE1vRNG5de/J6vlbjmdM+pO755cv5jR5MEw4S0oBwKBgQCNge/+MNpgZixOCu9W95pHRc+NlqJK5/mbrcvO55ucBD1OPkAhtz4wPqEVWPM8yl5QqKWxjX8Zojs8/dWClLvOnrHW+ubmiT4CMVoRSxlpzUQoWpcL/m8JX/p25wFyeHn7DBqb5xLCxuAsbCxUB35xzVvdaVXx2QIQY6vk2kfAXQKBgQCMm74ha+y19ZYpW8K3L3QaSydV6wbMgblG454JhJGhjqp5nIf59FLVw4EwwLegK3JBgBwisD6VyBnsz+8djGogtvr7009h4/ZBDzZVU+leZOceYrV2VMn5h/9KPL8OVLYu+AoC47LcQu0dwqc+6uayKKqKE1SvyTlf3wqDtnzIpQKBgQCnV7aKyUrteUQbsNljCVimKogddbDFnS58P/Z+GiNM0I7+++vozWYlJ6CYYBxCdfAldwB2bY2Fz+F43AiUN/QKsmCYqSqyzPxJPYZxNXsEqT/wsTNTvOnOAlZf/REIDkyEwrk4u6XmW+d2RewOywuTzW3U3Yskol2IB9/DsJXteg==";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAh2YUaXSURyrFjpili/rcbCoWaIPUNbwbnkJz6id5ZHVMAiot4QlLC5pTHrxWAfLAAUY/Woe8J11ySIjxGup0cL0KpPIUzklqcCDFEdCYA2vxs7I76XZLkuYdkNF/i2MBUHsMBXgAsVWlO4oyermZTVHfIIUY2Oc62Xkw4FERrnn7K8Y3q3Gz2lxD0+h1Px5/OGNZ0EhaasheA/DP6TkZ3IVdsRXOErvqLm105l5gg8hseggnNsbOSLsUtEfcncBv39Qow4ie8xRoQDmpW1KtRy3ttsBYWV1zbtH290x5ZlK6+LF+DvQSQjXEP9hg6CmhWVqS8+/LaZw/RfaQQ6IocwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    //这里地址为，支付成功之后跳转的地址，异步地址
    public static String notify_url = "http://localhost:8080/eBusiness/toIndex";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    //这里地址为，支付成功之后跳转的地址，同步
    public static String return_url = "http://localhost:8090/outpatientToll";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "gbk";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "D:\\idea\\Alipaylogs\\";

//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        File file1 = new File(log_path);
        if(!file1.exists()){
            //创建目录
            file1.mkdir();
        }
        try {
            writer = new FileWriter(log_path+"alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
